package site.zhouinfo.designpatterns.factory.generalfactory;

import site.zhouinfo.designpatterns.factory.common.MailSender;
import site.zhouinfo.designpatterns.factory.common.Sender;
import site.zhouinfo.designpatterns.factory.common.SmsSender;

/**
 * 普通工厂模式 工厂类
 *
 * @author zhou
 * @create 2017-06-21 17:12
 * @email zhouinfo@qq.com
 * @blog blog.zhouinfo.site
 */
public class SendFactory {
    public Sender produce(String type){
        if ("mail".equals(type)){
            return new MailSender();
        }else if ("sms".equals(type)){
            return new SmsSender();
        }else {
            System.out.println("输入正确的类型: mail sms");
            return null;
        }
    }
}
